import { BasicColumn } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
export const columns: BasicColumn[] = [
  {
    title: '设备名称',
    dataIndex: 'deviceName',
    width: 100,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
    sorter: true,
  },
  {
    title: '设备型号',
    dataIndex: 'deviceModel',
    width: 100,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
  {
    title: '设备SN',
    dataIndex: 'deviceSn',
    width: 100,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
  {
    title: '责任人',
    dataIndex: 'contactName',
    width: 100,
    // filters: [
    //   { text: '张三', value: '张三' },
    //   { text: '张三2', value: '张三2' }
    // ],
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
  {
    title: '联系方式',
    dataIndex: 'contactPhone',
    width: 100,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
  {
    title: '实时状态',
    dataIndex: 'state',
    width: 100,
    slots: { customRender: 'state' },
  },
  {
    title: '所属项目',
    dataIndex: 'projectName',
    width: 100,
    // filters: [
    //   { text: '华平1', value: '华平1' },
    //   { text: '华平2', value: '华平2' }
    // ],
    customRender: ({ text }) => {
      return render.renderTip(text, 9);
    },
  },
  {
    title: '最后在线定位',
    dataIndex: 'lastLocation',
    width: 100,
    customRender: ({ text }) => {
      return text == '[]' ? '' : render.renderTip(text, 9);
    },
    sorter: true,
  },
  {
    title: '最后在线时间',
    dataIndex: 'loginTime',
    width: 100,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
    sorter: true,
  },
];

export const playbackColumns: BasicColumn[] = [
  {
    title: '轨迹名称',
    dataIndex: 'k1',
    width: 150,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
  {
    title: '时长',
    dataIndex: 'k2',
    width: 150,
    customRender: ({ text }) => {
      return render.renderTip(text);
    },
  },
]

export const journalColumns: BasicColumn[] = [
  {
    title: '告警时间',
    dataIndex: 'startTime',
    width: 150,
  },
  {
    title: '告警等级',
    dataIndex: 'level',
    width: 150,
    slots: { customRender: 'status' },
  },
  {
    title: '设备',
    dataIndex: 'deviceType',
    width: 150,
    customRender: ({ text }) => {
      return text == 1 ? '飞行器' : text == 2 ? '机场' : '---'
    },
  },
  {
    title: '错误码',
    dataIndex: 'logCode',
    width: 150,
  },
  {
    title: '告警内容',
    dataIndex: 'alarmContent',
    width: 150,
  },
  {
    title: '解决方案',
    dataIndex: 'solution',
    width: 150,
  },
]
